package com.heyige.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("shares")
public class Share {
    
    @TableId(type = IdType.AUTO)
    private Long id;
    
    @TableField("user_id")
    private Long userId;
    
    @TableField("session_id")
    private Long sessionId;
    
    @TableField("share_code")
    private String shareCode;
    
    @TableField("title")
    private String title;
    
    @TableField("description")
    private String description;
    
    @TableField("share_type")
    private String shareType = ShareType.PUBLIC.name();
    
    @TableField("reward_quota")
    private Integer rewardQuota = 0;
    
    @TableField("max_view_count")
    private Integer maxViewCount;
    
    @TableField("view_count")
    private Integer viewCount = 0;
    
    @TableField("is_active")
    private Boolean isActive = true;
    
    @TableField("expire_time")
    private LocalDateTime expireTime;
    
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;
    
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;
    
    public enum ShareType {
        PUBLIC, PRIVATE, PASSWORD
    }
}